package com.silence.springboot.controller;

import com.mybatisflex.core.paginate.Page;
import com.silence.springboot.common.Result;
import com.silence.springboot.service.DailyHealthInfoService;
import com.silence.springboot.vo.input.PageDailyHealthInfoInput;
import com.silence.springboot.vo.input.SaveDailyHealthInfoInput;
import com.silence.springboot.vo.output.PageDailyHealthInfoOutput;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 每日健康管理表 控制层。
 *
 * @author mybatis-flex-helper automatic generation
 * @since 1.0
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@Tag(name = "每日健康管理表控制层")
@RequestMapping("/dailyHealthInfo")
public class DailyHealthInfoController {

    /**
     * 每日健康管理表
     */
    private final DailyHealthInfoService dailyHealthInfoService;

    /**
     * 分页查询
     *
     * @param input 入参
     * @return 分页查询
     */
    @PostMapping("/pageInfo")
    @Operation(summary = "分页查询", description = "分页查询")
    public Result<Page<PageDailyHealthInfoOutput>> pageInfo(@RequestBody PageDailyHealthInfoInput input) {
        // 返回成功
        return Result.success(dailyHealthInfoService.pageInfo(input));
    }

    /**
     * 保存每日健康信息
     *
     * @param input 入参
     * @return 保存每日健康信息
     */
    @PostMapping("/saveInfo")
    @Operation(summary = "保存每日健康信息", description = "保存每日健康信息")
    public Result<Void> saveInfo(@RequestBody SaveDailyHealthInfoInput input) {
        dailyHealthInfoService.saveInfo(input);
        // 返回成功
        return Result.success();
    }

}